/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package FourShTests;

import Rout.*;
import org.testng.annotations.*;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;

public class Shared4UNI {
    private GoBefore browser = new GoBefore(); 
    
    
    @BeforeMethod
    public void setUp() throws Exception {
        
        System.out.println("\n Run test: " + getClass().getSimpleName());
        browser.xpFilename = "/html/body/div[7]/div/div/div[2]/h1";
        browser.userAg = 1;
        browser.curURL = "http://www.4shared.com/photo/jIP-_j8sce/Test_file.html";
        browser.repDir = getClass().getSimpleName();
       
    }
       
    
@Test //UNI  
    public void UNI() throws Exception {
        GoBefore.trntConfig = false;
        
        
//        browser.changeDownDir();
        
        browser.cssButton = "#downloadHelperLink > div";
        browser.clButton = "helperButtonGradient";
        browser.xpButton = "//*[@id=\"downloadHelperLink\"]/div";
        
        browser.setUp();
        
        
        //Login
        WebElement logIN = browser.driver.findElement(By.xpath("//div[3]/div/i"));
        browser.driver.switchTo().activeElement();
        logIN.click();
        browser.driver.switchTo().activeElement().sendKeys("denis.mittin@yandex.com", Keys.TAB, "777_miniden", Keys.ENTER, Keys.ENTER);
        browser.driver.switchTo().defaultContent();
        browser.driver.get(browser.curURL);

        Thread.sleep(1000);
        
        //Click on Helper button -- Scrol down (Keys.PAGE_DOWN) -- click 
        browser.clicker.sendKeys(Keys.PAGE_DOWN).perform();               
        
        //sleep
        Thread.sleep(2000);
        browser.testRun();
        browser.lpDetect();
        browser.verFilePresent();
        browser.verFilename();
        
    }       
    
    @AfterMethod
    public void Down() throws Exception {
        browser.driver.quit();
        
    }

    
}

